﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Buccontrols;

namespace TestingApplication
{
    public partial class NotePad : PluginForm
    {
        public NotePad()
        {
            InitializeComponent();
            //Alle voids hier spreken voor zich, neem ik aan...
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog OpenDialog = new OpenFileDialog();
            OpenDialog.Title = "Open";
            OpenDialog.Filter = "All Files|*.*";
            try
            {
                if (OpenDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    richTextBox1.LoadFile(OpenDialog.FileName);
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show("Invalid File Format");
            }
            catch (Exception ex)
            { } //Do Nothing
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog SaveDialog = new SaveFileDialog();
            SaveDialog.Title = "Save";
            SaveDialog.Filter = "Rich Text Files|*.rtf";
            try
            {
                if (SaveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    richTextBox1.SaveFile(SaveDialog.FileName);
                }
            }
            catch (Exception ex)
            { } //Do Nothing
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void undoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Undo();
        }

        private void redoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Redo();
        }

        private void cutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Cut();
        }

        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Copy();
        }

        private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Paste();
        }

        private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectAll();
        }

        private void clearToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();
        }

        private void fontToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FontDialog Font = new FontDialog();
            try
            {
                Font.Font = richTextBox1.SelectionFont;
                if (Font.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    richTextBox1.SelectionFont = (Font)Font.Font.Clone();
                }
            }
            catch (Exception ex)
            {
            }
            //Do Nothing
        }

        private void colourToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ColorDialog Colour = new ColorDialog();
            try
            {
                Colour.Color = richTextBox1.SelectionColor;
                if (Colour.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    richTextBox1.SelectionColor = Colour.Color;
                }
            }
            catch (Exception ex)
            {
            }
            //Do Nothing
        }

    }
}
